/*private JTextField txtnombrecli
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jtree;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.border.TitledBorder;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;

/**
 *
 * @author diego
 */
public class Ventanajtree extends JFrame implements ActionListener {
    
    private JTree carros;
    private JPanel panelcarro;
    private JTextField txtnombrecli;
    //oscar gay
    //hdsuhduasgduiasdhuiasda
    //dsadsuiagdasud
    
    Ventanajtree (){
        
        
        this.setSize(400,300);
        this.setLayout(new BorderLayout());
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
        
        
        
        
        
     panelcarro=new JPanel();
     panelcarro.setBorder(new TitledBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY),"CATEGORIA DE CARROS"));
    //pcliente.setLayout(new GridLayout(3,3,5,5)); 
     panelcarro.setLayout(new FlowLayout());
        
        
        txtnombrecli=new JTextField(5);
        
        DefaultMutableTreeNode Carrolujo = new DefaultMutableTreeNode("CARROS DE LUJO");
            DefaultMutableTreeNode lamborghini = new DefaultMutableTreeNode("LAMBORGHINI");
            DefaultMutableTreeNode ferrari = new DefaultMutableTreeNode("FERRARI");
            DefaultMutableTreeNode porsche = new DefaultMutableTreeNode("PORSCHE");
            
            DefaultMutableTreeNode gallardo = new DefaultMutableTreeNode("Gallardo");
            DefaultMutableTreeNode murcielago = new DefaultMutableTreeNode("Murcielago");
            
        DefaultMutableTreeNode enzo = new DefaultMutableTreeNode("Enzo");
        DefaultMutableTreeNode testarrosa = new DefaultMutableTreeNode("Testarrosa");
        DefaultMutableTreeNode maranello = new DefaultMutableTreeNode("Maranello");
        
         DefaultMutableTreeNode nueve = new DefaultMutableTreeNode("911");
        DefaultMutableTreeNode cayanes = new DefaultMutableTreeNode("Cayane-s");
        DefaultMutableTreeNode panamera = new DefaultMutableTreeNode("Panamera");
        
        DefaultTreeModel  modelo = new DefaultTreeModel(Carrolujo);
        
        
        
        carros = new JTree(modelo);
        
        modelo.insertNodeInto(lamborghini,Carrolujo,0);
        modelo.insertNodeInto(ferrari,Carrolujo,0);
        modelo.insertNodeInto(porsche,Carrolujo,0);
        
        modelo.insertNodeInto(gallardo, lamborghini, 0);
        modelo.insertNodeInto(murcielago, lamborghini, 0);
        
        modelo.insertNodeInto(enzo, ferrari, 0);
        modelo.insertNodeInto(testarrosa, ferrari, 0);
        modelo.insertNodeInto(maranello, ferrari, 0);
        
        modelo.insertNodeInto(nueve, porsche, 0);
        modelo.insertNodeInto(cayanes, porsche, 0);
        modelo.insertNodeInto(panamera, porsche, 0);
        
        
        panelcarro.add(carros);
        //panelcliente.add(txtnombrecli);

        
        getContentPane().setLayout(new BoxLayout(getContentPane(),BoxLayout.Y_AXIS));
    this.getContentPane().add(panelcarro);
        
    }
    
    
    
    
    
    
    
    
    

    @Override
    public void actionPerformed(ActionEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
}
